﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MaintPersonManage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Btn_Add_Click(object sender, EventArgs e)
    {
        /*添加新的部门类别*/
        string MaintPersonName = this.DeviceTypeName.Text;
        string PN = this.txtPhoneNumber.Text;
        if (MaintPersonName != "" && PN != "")
        {
            MaintPerson maintName = new MaintPerson();
            if (maintName.AddMaintPersonName(MaintPersonName, PN))
                Response.Write("<script>alert('设备新人员信息添加成功!');location.href=location.href;</script>");
            else
                Response.Write("<script>alert('" + maintName.ErrMessage + "');</script>");
        }
        else
        {
            Response.Write("<script>alert('人员姓名与联系电话不能为空!');location.href=location.href;</script>");
        }
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //当鼠标选择某行时变颜色
            e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00ffee';");
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
            //Literal operation = (Literal)(e.Row.Cells[2].FindControl("operation"));
            //string deviceTypeId = e.Row.Cells[0].Text;
            //operation.Text = "<a href='MaintPersonEdit.aspx?maintPersonId=" + deviceTypeId + "'><img src='images/edit.gif' height=14 width=14 border=0>修改</a>&nbsp;&nbsp;<a href='MaintPersonDel.aspx?maintPersonId=" + deviceTypeId + "'><img src='images/delete.gif' width=14 height=14 border=0>删除</a>";
        }
    }
}
